package test.gateway.b;

import feign.Logger;
import feign.form.spring.SpringFormEncoder;
import org.springframework.beans.factory.ObjectFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.http.HttpMessageConverters;
import org.springframework.cloud.openfeign.support.SpringEncoder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class FeignConfigBeans {
    @Autowired
    private ObjectFactory<HttpMessageConverters> messageConverters;

    @Bean
    public SpringFormEncoder springFormEncoder(){
        return new SpringFormEncoder(new SpringEncoder(messageConverters));
    }

    // 开启 feign 的日志
    @Bean
    public Logger.Level logger() {
        return Logger.Level.FULL;
    }

}
